home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / unarced / utilities / shells / sksh / scr_source / qrm.s < prev    next >
Text File  |  1995-03-17  |  999b  |  31 lines

  1. #!c:sksh
  2.  
  3. #*************************************************************************
  4. #  This function accepts a number of parameters, and prompts the user
  5. #  for whether these files should be deleted.  For example, "qrm *.o"
  6. #  would prompt the user at each .o file.  Answering "Y" or "y" causes
  7. #  the file to be removed; otherwise, it is ignored.  A useful extention
  8. #  would look at only the first character of the response, thus allowing
  9. #  "yes" to be used in place of "y".
  10. #*************************************************************************
  11.  
  12.    local _ans _fspec
  13.  
  14.    if [ "$#" -eq 0 -o "$1" = '-?' ]
  15.    then
  16.       echo 'Usage:' $(basename $0) 'man-entry'
  17.       echo '       (Displays man page entries from the MAN: directory)'
  18.       return 1
  19.    fi
  20.  
  21.    for _fspec in $*
  22.    do
  23.       [ -f "$_fspec" ] || echo "File '$_fspec' does not exist." && continue
  24.  
  25.       echo -n "Remove $_fspec ? "
  26.       read _ans
  27.  
  28.       [ $(expr substr $(toupper "$_ans") 1 1) = 'Y' ] && rm -vf "$_fspec"
  29.  
  30.    done
  31.